package com.example.guiguihomemedical.service.impl;

import com.example.guiguihomemedical.entity.dto.RecordAdd;
import com.example.guiguihomemedical.mapper.RecordAddMapper;
import com.example.guiguihomemedical.mapper.RecordMapper;
import com.example.guiguihomemedical.service.RecordAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecordAddServiceImpl implements RecordAddService {
    @Autowired
    private RecordAddMapper recordAddMapper;

    @Override
    public void addRecord(RecordAdd recordAdd) {
        recordAddMapper.insertRecord(recordAdd);
        List<Integer> peopleidList = recordAdd.getPeopleidlist();
        String idcart = recordAdd.getIdcard();
        if (peopleidList != null) {
            for (Integer id : peopleidList) {
                recordAddMapper.insertClassification(idcart, id);
            }
        } else {
            System.out.println("peopleidList is null");
        }

    }
}
